//choice.js
//获取应用实例
var util = require('../../utils/util.js');
var app = getApp()
Page({
  data: {
    winWidth: 0,  
    winHeight: 0,   
    currentTab: 0, 
    newsType: 0,
    citys:[],
    index:0,
    selectCitysId: 0,
  },
  toDetail: function(e) {
    wx.navigateBack();
  },
  bindChanges: function(e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    this.setData({
      forma: e.detail.value
    })
  },
  
  selectCitys: function(e) {
    var that = this;
    app.globalData.newsType = that.data.newsType
    app.globalData.cityId = e.currentTarget.dataset.cityid
    wx.switchTab({
      url: '../index/index',
    })
  },
 
  onUnload: function() {
    var mainPage = getCurrentPages()[0];
    app.currentCityId = this.data.selectCitysId;
    mainPage.setData({  
      cityId: this.data.selectCitysId
    });
  },
   
  onLoad: function (opt) {
    this.setData({
      newsType: opt.newsType,
      citys: [{
            'id':'',
            'city':'全部',
          },{
            'id':1,
            'city':'北京',
          },{
            'id':2,
            'city':'上海',
          },{
            'id':4,
            'city':'广州',
          },{
            'id':5,
            'city':'江苏',
          },{
            'id':6,
            'city':'深圳',
          },{
            'id':7,
            'city':'武汉',
          }]
    })
  }
})